<%-- 
    Document   : cuenta
    Created on : 28-jun-2013, 10:41:45
    Author     : davidcabrera
--%>
<%@page import="negocio.Usuario"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<html lang="es">

    <head>
        <title>Mi Cuenta</title>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
        <link rel="stylesheet" type="text/css" media="screen" href="css/grid_12.css">
        <script src="js/jquery-1.7.min.js"></script>
        <script src="js/jquery.easing.1.3.js"></script>
        <script src="js/cufon-yui.js"></script>
        <script src="js/Asap_400.font.js"></script>
        <script src="js/Coolvetica_400.font.js"></script>
        <script src="js/Kozuka_M_500.font.js"></script>
        <script src="js/cufon-replace.js"></script>
        <script src="js/FF-cash.js"></script>

        <script language="JavaScript"> 
            function preguntaborrar(){ 
                if (confirm('¿Estas seguro de darte de baja?')){ 
                    document.location.href='baja.do'
                } 
            } 
        </script>
        <script language="JavaScript"> 
            function preguntamodificar(){ 
                if (confirm('¿Estas seguro de modificar tus datos?')){ 
                    document.getElementById('form').submit()
                } 
            } 
        </script>
    </head>
    <body>
        <div class="main">
            <div class="bg-img"></div>
            <!--==============================header=================================-->
             <header>
                <h1><a href="index.jsp">Sport <strong>Club</strong></a></h1>

                <div style="margin-top: 30px; margin-left: 750px">        

                </div> 
                <div >
                
                <logic:empty name="usuario" scope="session">
                        <html:form action="/login" >
                            <div>
                            <table border="0" class="login-form">
                                <tbody>
                                    <tr>
                                        <td><strong>Email:</strong></td>
                                        <td><html:text property="email" name="LoginForm" style="text-align:right"/></td>
                                    </tr>
                                    <tr>
                                        <td><strong>Clave:</strong></td>
                                        <td><html:password property="pass" name="LoginForm" style="text-align:right"/></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="button" style="text-align:right;"><html:submit value="Login"/></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" style="text-align:right"><a href="registro.jsp" class="color-1">¡Registrate!</a></td>
                                    </tr>

                                </tbody>
                            </table>
                                    </div>
                        </html:form>
                    </logic:empty>
                        
                        <logic:notEmpty name="usuario" scope="session">
                            <div style="text-align: right" >
                            Bienvenido, <strong><a class="link" href="cuenta.do"><bean:write name="usuario" property="nombre"/></a></strong>

                            <br/>
                            <a class="link" href="unlogin.do" >Desconectar</a>
                            </div>
                        </logic:notEmpty>
                    
                </div>


                <nav style="clear: both">
                    
                    <ul class="menu">
                        <li><a href="index.jsp">Principal</a></li>
                        <li><a href="instalaciones.do">Instalaciones</a></li>
                        <li><a href="galeria.jsp">Galeria</a></li>
                        <li><a href="contacta.jsp">Contacta</a></li>
                    </ul>
                </nav>
            </header>   
            <!--==============================content================================-->
            <section id="content">
                <div class="container_12">
                    <div class="grid_12">
                        <div class="box-shadow">
                            <div class="wrap block-2">
                                <div class="col-4">
                                    <h2>Mis <span class="color-1">Datos</span></h2>

                                    <%
                                        Usuario us = (Usuario) request.getSession().getAttribute("usuario");

                                    %>
                                    <html:errors />
                                    <html:form action="/modificar" styleId="form" >
                                        <fieldset>
                                            <html:hidden value="<%= String.valueOf(us.getIdUsuario())%>" property="idUsuario" />
                                            <strong>Nombre</strong><label><html:text value='<%= us.getNombre()%>'  property="nombre" onblur="if(this.value=='') this.value='<%= us.getNombre()%>'" onfocus="if(this.value =='<%= us.getNombre()%>' ) this.value=''" /></label>
                                            <br/><strong>Email</strong><label><html:text value='<%= us.getEmail()%>'  property="email" onblur="if(this.value=='') this.value='<%= us.getEmail()%>'" onfocus="if(this.value =='<%= us.getEmail()%>' ) this.value=''" /></label>
                                            <br/><strong>Contraseña</strong><label><html:password value='<%= us.getPass() %>'  property="pass" onblur="if(this.value=='') this.value='<%= us.getPass() %>'" onfocus="if(this.value =='<%= us.getPass() %>' ) this.value=''" /></label>

                                            <div class="btns">
                                                <a href="#" class="button" onClick="preguntamodificar()">Editar</a>
                                                <a href="#" class="button" onclick="preguntaborrar()">Darse de Baja</a>
                                                <logic:equal name="usuario" property="administrador" value="true">
                                                    <a href="panelcontrol.do" class="button" >Administrador</a>
                                                </logic:equal>
                                                
                                            </div>
                                        </fieldset>  
                                    </html:form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>

                </div>
            </section> 
            <!--==============================footer=================================-->
           </div>
    <%@include file="footer.jsp" %>
</body>
</html>

